package cn.share.life.common.sensitiveword.config;

import cn.share.life.common.pojo.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import java.util.List;

@Slf4j
@Component
public class InitSensitiveWord implements CommandLineRunner {


    @Autowired
    private RemoteUserService remoteUserService;

    @Autowired
    private RedisService redisService;

    @Override
    public void run(String... args) throws Exception {
        R<List<String>> listR = remoteUserService.selectList();
        redisService.setCacheObject(CacheConstants.SENSITIVE_WORD_LIST, listR.getData());
        log.info("敏感词加载成功");
    }

}
